package main

type MyStack struct {
	queue []int
}

/** Initialize your data structure here. */
func Constructor() MyStack {
	return MyStack{}
}

/** Push element x onto stack. */
func (this *MyStack) Push(x int) {
	tmp := []int{x}
	tmp = append(tmp, this.queue...)
	this.queue = tmp
}

/** Removes the element on top of the stack and returns that element. */
func (this *MyStack) Pop() int {
	head := this.queue[0]
	this.queue = this.queue[1:]
	return head
}

/** Get the top element. */
func (this *MyStack) Top() int {
	return this.queue[0]
}

/** Returns whether the stack is empty. */
func (this *MyStack) Empty() bool {
	return len(this.queue) == 0
}

func main() {
	stack := Constructor()
	stack.Push(1)
	stack.Push(2)
	stack.Push(3)
	println(stack.Pop())
	println(stack.Pop())
	println(stack.Pop())
}
